//
//  TopicCollectionViewCell.m
//  ThePrivateKitchen
//
//  Created by lirui on 16/1/20.
//  Copyright © 2016年 www.lanou3g.com蓝鸥科技. All rights reserved.
//

#import "TopicCollectionViewCell.h"

@implementation TopicCollectionViewCell

- (void)dealloc
{
    [_imgview release];
    [_title release];
    [super dealloc];
}
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        //imgview
        self.imgview = [[ UIImageView alloc] init];
        _imgview.backgroundColor = [ UIColor grayColor];
        [self.contentView addSubview:_imgview];
        [_imgview release];
        _imgview.layer.cornerRadius =20;
        _imgview.clipsToBounds = YES;
        //titlel
        self.title =[[  UILabel alloc] init];
        // _title.backgroundColor = [ UIColor greenColor];
        [self.imgview addSubview:_title];
        [_title release];
        _title.font =[ UIFont systemFontOfSize:13];
        _title.textAlignment = NSTextAlignmentCenter;
        
    }
    return self;
}

//布局方法
- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
    _imgview.frame = CGRectMake(0, 0, layoutAttributes.size.width , layoutAttributes.size.height +20);
    _title.frame = CGRectMake(0, _imgview.frame.size.height - 20 , layoutAttributes.size.width , 20);
}

@end
